<?php

use Illuminate\Routing\Router;

Admin::registerAuthRoutes();

Route::group([
    'prefix'        => config('admin.route.prefix'),
    'namespace'     => config('admin.route.namespace'),
    'middleware'    => config('admin.route.middleware'),
], function (Router $router) {

    $router->get('/', 'HomeController@index');

    //图书分类
    $router->get('categories', 'CategoriesController@index');
    $router->get('categories/create', 'CategoriesController@create');
    $router->post('categories', 'CategoriesController@store');
    $router->get('categories/{id}/edit', 'CategoriesController@edit');
    $router->put('categories/{id}', 'CategoriesController@update');
    $router->delete('categories/{id}', 'CategoriesController@destroy');

    //书单分类
    $router->get('book_list_categories', 'BookListCategoriesController@index');
    $router->post('book_list_categories', 'BookListCategoriesController@store');
    $router->get('book_list_categories/create', 'BookListCategoriesController@create');
    $router->get('book_list_categories/{id}/edit', 'BookListCategoriesController@edit');
    $router->put('book_list_categories/{id}', 'BookListCategoriesController@update');
    $router->delete('book_list_categories/{id}', 'BookListCategoriesController@destroy');

    //图书
    $router->get('books', 'BooksController@index');
    $router->get('books/create', 'BooksController@create');
    $router->post('books', 'BooksController@store');
    $router->get('books/{id}/edit', 'BooksController@edit');
    $router->put('books/{id}', 'BooksController@update');
    $router->delete('books/{id}', 'BooksController@destroy');

    //系统图书评价
    $router->get('book_comments', 'BookCommentsController@index');
    //$router->get('book_comments/create', 'BookCommentsController@create');
    $router->post('book_comments', 'BookCommentsController@store');
    $router->get('book_comments/{id}', 'BookCommentsController@show');
    $router->delete('book_comments/{book_id}/{id}', 'BookCommentsController@destroy');
    $router->get('book_comments/{book_id}/create', 'BookCommentsController@create');
    $router->post('book_comments/{book_id}', 'BookCommentsController@store');

    //$router->get('book_comments/{id}/edit', 'BookCommentsController@edit');
    //$router->put('book_comments/{id}', 'BookCommentsController@update');
    //$router->delete('book_comments/{id}', 'BookCommentsController@destroy');

    //用户图书评价
    $router->get('user_book_comments', 'UserBookCommentsController@index');
    $router->get('user_book_comments/{id}', 'UserBookCommentsController@show');
    $router->delete('user_book_comments/{book_id}/{id}', 'UserBookCommentsController@destroy');
    $router->get('user_book_comments/{book_id}/{id}/edit', 'UserBookCommentsController@edit');
    $router->put('user_book_comments/{book_id}/{id}', 'UserBookCommentsController@update');

    //$router->delete('user_book_comments/{id}', 'UserBookCommentsController@destroy');

    //书单管理
    $router->resource('book_lists', BookListsController::class);
    $router->put('book_lists/{book_list_id}/{pk}', 'BookListsController@sort');

    //用户管理
    $router->resource('users', UsersController::class);

    //banner管理
    $router->resource('banners', BannersController::class);

    $router->get('orders', 'OrdersController@index')->name('admin.orders.index');
    $router->get('orders/{order}', 'OrdersController@show')->name('admin.orders.show');
    $router->post('orders/{order}/ship', 'OrdersController@ship')->name('admin.orders.ship');  //发货
    $router->post('orders/{order}/cancel', 'OrdersController@cancel')->name('admin.orders.cancel');  //取消订单
    //$router->post('orders/{order}/confirm', 'OrdersController@confirm')->name('admin.orders.confirm');  //确认收货

    $router->get('orders2', 'Orders2Controller@index')->name('admin.orders2.index');
    $router->get('orders2/{order}', 'Orders2Controller@show')->name('admin.orders2.show');
    $router->post('orders2/{order}/ship', 'Orders2Controller@ship')->name('admin.orders2.ship');

    $router->get('orders3', 'Orders3Controller@index')->name('admin.orders3.index');
    $router->get('orders3/{order}', 'Orders3Controller@show')->name('admin.orders3.show');
    $router->post('orders3/{order}/confirm', 'Orders3Controller@confirm')->name('admin.orders3.confirm');  //确认收货

    $router->get('orders4', 'Orders4Controller@index')->name('admin.orders4.index');

    $router->resource('book_hot_search_words', BookHotSearchWordsController::class);

    $router->resource('user_want_books', UserWantBookController::class);
});
